home *** CD-ROM | disk | FTP | other *** search
- Path: camelot.dsccc.com!kcline
- From: kcline@sun132.spd.dsccc.com (Kevin Cline)
- Newsgroups: comp.sys.sgi.apps,comp.lang.c++
- Subject: Re: SGI's C++ compiler and the boolean type
- Date: 19 Apr 1996 15:04:04 GMT
- Organization: DSC Communications Corporation Switch Products Division
- Message-ID: <4l8a14$5g@tpd.dsccc.com>
- References: <4kefm7$oao@ncar.ucar.edu> <4kg6fv$h7k@nic.ftns.no> <31770390.2781@llnl.gov>
- NNTP-Posting-Host: sun132.spd.dsccc.com
-
- In article <31770390.2781@llnl.gov>, Scott Nelson <nelson18@llnl.gov> wrote:
- >Arthur Hagen wrote:
- >>
- >> >
- >> > typedef int bool;
- >> > #define true 1
- >> > #define false 0
- >>
- >> And some argue that true should be -1, because then bitwise not works:
- >>
- >
- >We use the following. It's safe on all platforms:
- >
- >#define FALSE 0
- >#define TRUE (!0)
- >
- >Let the built-in ! operator determine what TRUE really is.
- >
- >Scott Nelson
-
- The real lesson here is to write
- if (x)
- or
- if (!x)
-
- instead of
- if (x == true)
- and
- if (x == false)
-
- Then it doesn't matter what the value of true is, as long as it is not zero.
- --
- Kevin Cline
-